package com.dy.sucetity.exception;

import com.dy.sucetity.constant.ResultCodeEnum;
import org.springframework.http.HttpStatus;

/**
 * @ClassName:
 * @Author: dingyu
 * @Desctiption: (描述) 自定义异常
 * @Date: 2022/3/31 9:48
 * @Version 1.0 (版本)
 */
public class BadRequestException extends RuntimeException{
    private Integer status;
    public BadRequestException(String msg) {
        super(msg);
        this.status = HttpStatus.BAD_REQUEST.value();
    }

    public BadRequestException(HttpStatus status, String msg) {
        super(msg);
        this.status = HttpStatus.BAD_REQUEST.value();
        this.status = status.value();
    }

    public BadRequestException(Integer code, String msg) {
        super(msg);
        this.status = HttpStatus.BAD_REQUEST.value();
        this.status = code;
    }

    public BadRequestException(ResultCodeEnum codeEnum) {
        super(codeEnum.getMessage());
        this.status = HttpStatus.BAD_REQUEST.value();
        this.status = codeEnum.getCode();
    }
    public Integer getStatus() {
        return this.status;
    }
}
